<extend name="Public:base" />
<block name="main">
    <div class="content" id="js-date">
        <section class="location">
            <i class="iconfont">&#xe60f</i> 位置：<a href="{:U('Index/main')}">管理首页</a> &gt; <a href="{:U('Activity/update',array('id'=>$id))}">抽奖管理</a> &gt; 二维码管理
        </section>
        <ul class="nav-tabs clearfix">
            <li class="active">二维码管理</li>
        </ul>
        <form method="get" action="{:U('Activity/actcodeout')}" id="form" class="well">
            <input type="hidden" name="id" value="{$id}" />
            二维码数量 <input type="text" name="code_num" class="form-control" value="50" /> 
            <button type="submit" class="btn btn-theme">生成二维码</button>
        </form>
        <div>总获奖金额 ￥{$prize_money}元</div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-hover">
            <thead>
                <tr>
                    <th width="20"><input type="checkbox" name="chkAll" id="chkAll" onClick="ChkAllClick('id[]', 'chkAll')" /></th>
                    <th width="20">ID</th>
                    <th>二维码</th>
                    <th width="150">发布时间</th>
                    <th width="150"><a href="/Fwadmin/Activity/actcode/id/1?order=load_num">下载次数</a></th>
                    <th width="150">最后下载时间</th>
                    <th width="150"><a href="/Fwadmin/Activity/actcode/id/1?order=prize_money">中奖金额(分)</a></th>
                    <th width="150"><a href="/Fwadmin/Activity/actcode/id/1?order=prize_time">中奖时间</a></th>
                </tr>
            </thead>
            <tbody>
            <volist name="viewList" id="data" empty="暂时没有数据">
                <tr>
                    <td><input type="checkbox" name="id" id="chkSon{$data.id}" value="{$data.id}" /></td>
                    <td>{$data.id}</td>
                    <td><img src="{$data.qr_img}" style="width: 100px"/></td>
                    <td>{$data.add_time|date='Y-m-d',###}</td>
                    <td>{$data.load_num}</td>
                    <td>{$data.load_time|date='Y-m-d',###}</td>
                    <td>{$data.prize_money}</td>
                    <td>{$data.prize_time|date='Y-m-d',###}</td>
                </tr>
            </volist>
            </tbody>
        </table>
        <div class="well clearfix">
            <div class="fl"><button type="button" class="btn btn-theme" onclick="loadqrcode(0)">导出选中的二维码</button>
            <button type="button" class="btn btn-theme" onclick="loadqrcode(1)">导出未下载的二维码</button>
            </div>
            <div class="pages">{$pages}</div>
        </div>
</block>
<block name="JS">
    <script type="text/JavaScript">
    function loadqrcode(type){
        if(type==1){
            window.open('/Fwadmin/Activity/download?type=1');
            return;
        }
        var chk_value =[];
        $('input[name="id"]:checked').each(function(){
            chk_value.push($(this).val());
        });
        if(chk_value.length==0){
            alert ('你还没有选择任何内容！');
            return false;
        }
        window.open('/Fwadmin/Activity/download?type=0&id='+chk_value.toString());
    }
    </script>
</block>